/*
 *    Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.prdownloader.database;

import ohos.data.rdb.RdbStore;

import java.util.List;

/**
 * 数据库持有者接口
 *
 * @author amitshekhar
 * @since 2017-11-17
 */

public interface DbHelper {

    /**
     * 获取下载bean
     * @param id
     * @return DownloadModel
     */
    DownloadModel find(int id);

    /**
     * 插入
     * @param model
     */
    void insert(DownloadModel model);
    /**
     * 更新
     * @param model
     */
    void update(DownloadModel model);

    /**
     * 更新进度
     * @param id
     * @param downloadedBytes
     * @param lastModifiedAt
     */
    void updateProgress(int id, long downloadedBytes, long lastModifiedAt);

    /**
     * 移除
     * @param id
     */
    void remove(int id);

    /**
     * 多少天以后删除
     * @param days
     * @return  List<DownloadModel>
     */
    List<DownloadModel> getUnwantedModels(int days);

    /**
     * 清除
     */
    void clear();
    /*
    *获取数据库
    */
    RdbStore getDb();
}
